<?php

use Api\Http\Controllers\CollageController;
use Api\Http\Controllers\CooperateController;
use Api\Http\Controllers\FilmController;
use Api\Http\Controllers\MemberAddressController;
use Api\Http\Controllers\MemberController;
use Api\Http\Controllers\MembersCouponController;
use Api\Http\Controllers\MemberVirtualController;
use Api\Http\Controllers\OrderController;
use Api\Http\Controllers\SourcesController;
use Api\Http\Controllers\WechatController;
use Api\Middlewares\CheckUserLogin;
use Illuminate\Support\Facades\Route;
use Modules\Collage\Http\Controllers\BannerController;
use Modules\Common\Http\Controllers\AreaController;
use Modules\Member\Http\Controllers\MembersVirtualController;


Route::middleware([CheckUserLogin::class])->group(function () {
    Route::get('users/city_agent_info', [MemberController::class, 'cityAgentInfo']); //代理明细
    Route::apiResource('users', MemberController::class)->except(['show'])->withoutMiddleware([CheckUserLogin::class]); //用户登录
    Route::get('users/show', [MemberController::class, 'show']); //获取用户信息
    Route::post('users/bind_mobile', [MemberController::class, 'bindMobile']); //绑定手机号
    Route::post('users/getuserinfo', [MemberController::class, 'getUserInfo']); //获取用户信息
    Route::post('users/share_image', [MemberController::class, 'ShareImage'])->withoutMiddleware([CheckUserLogin::class]); //二维码图片
    Route::post('users/dowith', [MemberController::class, 'dowith']); //申请提现
    Route::post('users/withdraw_record', [MemberController::class, 'withdrawRecord']); //申请提现
    Route::get('users/virtual', [MemberVirtualController::class, 'index']); //虚拟用户列表
    Route::post('users/update_city_agent', [MemberController::class, 'updateCityAgent']); //代理升级

    Route::get('users/profit_give',[MemberController::class,'profitGive'])->withoutMiddleware([CheckUserLogin::class]); //二维码图片

   //等级中心
    Route::get('users/vip_center', [MemberController::class, 'vipCenter']); //等级中心

    //等级中心
    Route::get('sources/test', [SourcesController::class, 'test'])->withoutMiddleware([CheckUserLogin::class]); //常见问题
   //常见问题
    Route::get('users/cms_resource', [MemberController::class, 'cmsResource'])->withoutMiddleware([CheckUserLogin::class]); //常见问题
    //订单
    Route::post('/order/check_channel', [OrderController::class, 'checkChannel']); //下单渠道检测
    Route::post('/order/yida_check_channel', [OrderController::class, 'yidaCheckChannel']); //易达下单渠道检测
    Route::post('order/get_route', [OrderController::class, 'getRoute']); //物流轨迹信息
    Route::post('order/cancel_order', [OrderController::class, 'cancelOrder']); //物流轨迹信息
    Route::post('order/callback', [OrderController::class, 'callback'])->withoutMiddleware([CheckUserLogin::class]);; //物流信息更改回调
    Route::get('order/team_order', [OrderController::class, 'teamOrder']); //物流信息更改回调
    Route::get('order/overweight_order', [OrderController::class, 'overweightOrder']); //超重订单列表
    Route::get('order/refund_record', [OrderController::class, 'RefundRecord']); //退款记录

    //资源列表
    Route::get('sources/list',[SourcesController::class,'list']);
    Route::get('sources/netdisk_url',[SourcesController::class,'getNetdiskUrl']);



    //优惠券
    Route::get('/coupon/welfare_list', [MembersCouponController::class, 'welfareList']);//抢购优惠券列表
    Route::get('/coupon/get_coupon/{id}', [MembersCouponController::class, 'getCoupon']);//抢券

    //团队推广
    Route::get('/users/publish_info', [MemberController::class, 'PublishInfo']);//团队推广列表
    Route::get('/users/publish_list', [MemberController::class, 'PublishList']);//团队推广列表
    //推广海报
    Route::get('/users/get_poster', [MemberController::class, 'getPoster']);//推广海报

    //微信支付
    Route::post('/wechat/get_pay_info',[WechatController::class,'getPayInfo']);
    //升级订单支付
    Route::post('/wechat/get_level_pay_info',[WechatController::class,'levelPayInfo']);
    //电影票订单支付
    Route::post('/wechat/get_film_pay_info',[WechatController::class,'getFilmPayInfo']);

    //易达获取快递员信息
    Route::any('/order/yida_callback',[OrderController::class,'yidaCallback'])->withoutMiddleware([CheckUserLogin::class]);


    //微信退款
    Route::post('/wechat/refund',[WechatController::class,'refundOrder'])->withoutMiddleware([CheckUserLogin::class]);
    Route::get('/wechat/official_config',[WechatController::class,'officialConfig'])->withoutMiddleware([CheckUserLogin::class]);
    //微信关注公众号触发回调
    Route::any('/wechat/follow_account',[WechatController::class,'followAccount'])->withoutMiddleware([CheckUserLogin::class]);

    Route::get('/wechat/check_refund/{$order_sn}',[WechatController::class,'checkRefund'])->withoutMiddleware([CheckUserLogin::class]);

//    Route::post('profit',[WechatController::class,'profit'])->withoutMiddleware([CheckUserLogin::class]);

    //微信快递订单回调
    Route::post('/wechat/callback',[WechatController::class,'callback'])->withoutMiddleware([CheckUserLogin::class]);

    //获取耗材支付信息
    Route::post('/wechat/haocai_pay_info',[WechatController::class,'getHaocaiPayInfo']);
    //耗材支付回调
    Route::post('/wechat/haocai_callback',[WechatController::class,'haocaiCallback'])->withoutMiddleware([CheckUserLogin::class]);
    //耗材退款回调
    Route::post('/wechat/haocai_refund_callback',[WechatController::class,'haocaiRefundCallback'])->withoutMiddleware([CheckUserLogin::class]);
    //微信升级订单回调
    Route::post('/wechat/level_callback',[WechatController::class,'levelCallback'])->withoutMiddleware([CheckUserLogin::class]);

    //电影票支付退款订单回调
    Route::post('/wechat/film_callback',[WechatController::class,'filmCallback'])->withoutMiddleware([CheckUserLogin::class]);
    //微信消息推送验证
    Route::get('/wechat/publish',[WechatController::class,'publish'])->withoutMiddleware([CheckUserLogin::class]);

    //电影票分组接口
    Route::prefix('film')->group(function (){
        Route::post('sliderList', [FilmController::class, 'sliderList']); //热映轮播图
        Route::post('getCinemas', [FilmController::class, 'getCinemas']); //获取影院列表
        Route::post('getCityList', [FilmController::class, 'getCityList']); //获取城市列表
        Route::post('getCinemaSchedule', [FilmController::class, 'getCinemaSchedule']); //获取影院排期信息
        Route::post('cinemaDetail', [FilmController::class, 'cinemaDetail']); //影院详情
        Route::post('filmRegions', [FilmController::class, 'filmRegions']); //搜索某部影片在城市各区域的排片量
        Route::post('checkTicketPrices', [FilmController::class, 'checkTicketPrices']); //选择座位,传入原票价信息,计算出售价数据
        Route::post('getHotMovies', [FilmController::class, 'getHotMovies']); //获取热映列表
        Route::post('getInComingMovies', [FilmController::class, 'getInComingMovies']); //获取即将上映列表
        Route::post('getMovieScheduleDetail', [FilmController::class, 'getMovieScheduleDetail']); //获取影片的场次详情
        Route::post('getMovieSeats', [FilmController::class, 'getMovieSeats']); //获取某场次的座位列表
        Route::post('moviePlayDate', [FilmController::class, 'moviePlayDate']); //查询影片播放日期列表
        Route::post('createOrder', [FilmController::class, 'createOrder']); //下单
        Route::post('preOrder', [FilmController::class, 'preOrder']); //检查座位状态是否可抢
        Route::post('callback', [FilmController::class, 'callback'])->withoutMiddleware([CheckUserLogin::class]); //电影票回调
        Route::get('refund_film_order', [WechatController::class, 'refundFilmOrder'])->withoutMiddleware([CheckUserLogin::class]); //电影票回调
        Route::post('test', [FilmController::class, 'test']); //模拟真实下单
        Route::post('profit_list', [FilmController::class, 'profitList']); //分销收益
    });


    //资源路由
    Route::apiResource('users_address', MemberAddressController::class); //用户地址
    Route::apiResource('order', OrderController::class); //订单
    Route::apiResource('coupon', MembersCouponController::class);  //用户优惠券资源路由
    Route::apiResource('cooperate', CooperateController::class); //用户地址
    Route::apiResource('films/order', FilmController::class)->only(['index', 'show']);  //电影订单列表
    Route::post('test', [WechatController::class,'test']); //用户地址

    //关闭订单
    Route::any('close_order', [OrderController::class,'closeOrder'])->withoutMiddleware([CheckUserLogin::class]);

    Route::controller(AreaController::class)->group(function () {
        Route::get('areas', 'index');
    })->withoutMiddleware([CheckUserLogin::class]);

    //商学院
    Route::prefix('collage')->group(function (){
        Route::get('banner', [CollageController::class, 'bannerList']);
        Route::get('guide', [CollageController::class, 'guideList']);
        Route::get('resources/{type}', [CollageController::class, 'resourcesList']);
    });




});
